﻿
namespace EnsureWeb.Web.DomainService
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using EnsureWeb.Web.DataModel;


    // Implements application logic using the EnsureWebEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public partial class EnsureWebDomainService : LinqToEntitiesDomainService<EnsureWebEntities>
    {

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'MembershipPower' query.
        public IQueryable<MembershipPower> GetMembershipPower()
        {
            return this.ObjectContext.MembershipPower;
        }

        public void InsertMembershipPower(MembershipPower MembershipPower)
        {
            if ((MembershipPower.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipPower, EntityState.Added);
            }
            else
            {
                this.ObjectContext.MembershipPower.AddObject(MembershipPower);
            }
        }

        public void UpdateMembershipPower(MembershipPower currentMembershipPower)
        {
            this.ObjectContext.MembershipPower.AttachAsModified(currentMembershipPower, this.ChangeSet.GetOriginal(currentMembershipPower));
        }

        public void DeleteMembershipPower(MembershipPower MembershipPower)
        {
            if ((MembershipPower.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipPower, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.MembershipPower.Attach(MembershipPower);
                this.ObjectContext.MembershipPower.DeleteObject(MembershipPower);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'MembershipRole' query.
        public IQueryable<MembershipRole> GetMembershipRole()
        {
            return this.ObjectContext.MembershipRole;
        }

        public void InsertMembershipRole(MembershipRole MembershipRole)
        {
            if ((MembershipRole.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipRole, EntityState.Added);
            }
            else
            {
                this.ObjectContext.MembershipRole.AddObject(MembershipRole);
            }
        }

        public void UpdateMembershipRole(MembershipRole currentMembershipRole)
        {
            this.ObjectContext.MembershipRole.AttachAsModified(currentMembershipRole, this.ChangeSet.GetOriginal(currentMembershipRole));
        }

        public void DeleteMembershipRole(MembershipRole MembershipRole)
        {
            if ((MembershipRole.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipRole, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.MembershipRole.Attach(MembershipRole);
                this.ObjectContext.MembershipRole.DeleteObject(MembershipRole);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'MembershipRolePower' query.
        public IQueryable<MembershipRolePower> GetMembershipRolePower()
        {
            return this.ObjectContext.MembershipRolePower;
        }

        public void InsertMembershipRolePower(MembershipRolePower MembershipRolePower)
        {
            if ((MembershipRolePower.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipRolePower, EntityState.Added);
            }
            else
            {
                this.ObjectContext.MembershipRolePower.AddObject(MembershipRolePower);
            }
        }

        public void UpdateMembershipRolePower(MembershipRolePower currentMembershipRolePower)
        {
            this.ObjectContext.MembershipRolePower.AttachAsModified(currentMembershipRolePower, this.ChangeSet.GetOriginal(currentMembershipRolePower));
        }

        public void DeleteMembershipRolePower(MembershipRolePower MembershipRolePower)
        {
            if ((MembershipRolePower.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipRolePower, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.MembershipRolePower.Attach(MembershipRolePower);
                this.ObjectContext.MembershipRolePower.DeleteObject(MembershipRolePower);
            }
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'MembershipUser' query.
        public IQueryable<MembershipUser> GetMembershipUser()
        {
            return this.ObjectContext.MembershipUser;
        }

        public void InsertMembershipUser(MembershipUser MembershipUser)
        {
            if ((MembershipUser.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipUser, EntityState.Added);
            }
            else
            {
                this.ObjectContext.MembershipUser.AddObject(MembershipUser);
            }
        }

        public void UpdateMembershipUser(MembershipUser currentMembershipUser)
        {
            this.ObjectContext.MembershipUser.AttachAsModified(currentMembershipUser, this.ChangeSet.GetOriginal(currentMembershipUser));
        }

        public void DeleteMembershipUser(MembershipUser MembershipUser)
        {
            if ((MembershipUser.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(MembershipUser, EntityState.Deleted);
            }
            else
            {
                this.ObjectContext.MembershipUser.Attach(MembershipUser);
                this.ObjectContext.MembershipUser.DeleteObject(MembershipUser);
            }
        }

    }
}


